.netCHARTING v4.4 Documentation Send comments on this topic.
Axis Scales
Getting Started > General Tutorials > Axis Tutorials > Axis Scales

Glossary Item Box

Axis Scales


Introduction
This section will describe the following:


Scale Types

Axis scales dictate more than just the values on an axis. They also specify element behavior such as stacked, or FullStacked. The options for the Scale enumeration include:

Between numeric and time scales, .netCHARTING will automatically set the appropriate scale so it does not always need to be specified explicitly. Scales such as Stacked or FullStacked only apply to axes on which the element y values are plotted because these are the values that are stacked. For example with a combo chart, the Chart.YAxis would be the one to specify a stacked scale.

Other properties that control the scale include:


Intervals

Intervals come in two flavors, numeric, and time. The latter is more complicated so we’ll tackle numeric first.

Controlling the interval is a simple concept. You can specify a numeric interval using code such as:

[C#]

Chart.YAxis.Interval = 5;

[Visual Basic]

Chart.YAxis.Interval = 5

This will force an interval every at five numeric units. Other interval related properties include:


Time interval

The basic time interval is controlled with the Axis.TimeInterval property

[C#]

Axis.TimeInterval = TimeInterval.Week;

[Visual Basic]

Axis.TimeInterval = TimeInterval.Week

 

Advanced time interval

Or can be more specific using the Axis.TimeIntervalAdvanced property.

Multiplier

Using the advanced time interval version allows you to specify an interval multiplier. For example we can have an interval every 4 days or 2 weeks etc.

[C#]

Axis.TimeIntervalAdvanced.Multiplier = 2;

[Visual Basic]

Axis.TimeIntervalAdvanced.Multiplier = 2

Custom time span

A completely custom time span can be used as a time interval.

[C#]

Axis.TimeIntervalAdvanced.TimeSpan = new TimeSpan(10,5,3);

[Visual Basic]

Axis.TimeIntervalAdvanced.TimeSpan = New TimeSpan(10,5,3)

 

Custom start time

An interval can also start at any given time. These times can be specified through the following properties:


Ranges

The scale’s numeric and time boundaries can be specified using the Axis.ScaleRange property.

[C#]

Chart.YAxis.ScaleRange.ValueHigh = 100;
Chart.YAxis.ScaleRange.ValueLow = 2;
//Or
Chart.YAxis.ScaleRange.ValueHigh = new DateTime(2000,12,1);
Chart.YAxis.ScaleRange.ValueLow = new DateTime(2000,1,1);

[Visual Basic]

Chart.YAxis.ScaleRange.ValueHigh = 100
Chart.YAxis.ScaleRange.ValueLow = 2
'Or
Chart.YAxis.ScaleRange.ValueHigh = New DateTime(2000,12,1)
Chart.YAxis.ScaleRange.ValueLow = New DateTime(2000,1,1)

Providing a single high or low value without its counterpart is also permitted.

[C#]

YAxis.ScaleRange.ValueLow = 2;

[Visual Basic]

YAxis.ScaleRange.ValueLow = 2;

Note: Numeric intervals start at zero, therefore, if the minimum value doesn’t land on an interval there may be a gap between the scale’s edge and the first axis tick.


Time scales can be padded with an equal amount of time on either side of the plotted data to produce the final range. This is achieved using Axis.TimePadding.

 
[C#]

Chart.XAxis.TimePadding = TimeSpan.FromDays(10);

[Visual Basic]

Chart.XAxis.TimePadding = TimeSpan.FromDays(10)

Scale Breaks

Scale breaks are discontinuities in an axis' scale. They are useful in the following scenarios:


For the first case, the chart engine can automatically generate a scale break by setting Axis.SmartScaleBreak to true.

Sample: AxisScaleBreaks.aspx

Scale breaks are added manually like so:

[C#]

Axis.ScaleBreaks.Add( new ScaleRange(0,50) );
//Or for time:
Axis.ScaleBreaks.Add( new ScaleRange(new DateTime(2000,1,1), new DateTime(2000,12,1) ) );

[Visual Basic]

Axis.ScaleBreaks.Add( New ScaleRange(0,50) )
'Or for time:
Axis.ScaleBreaks.Add( New ScaleRange(New DateTime(2000,1,1), New DateTime(2000,12,1) ) )


 

Sample: AxisScaleBreaksManual.aspx

 

Scale Break Styles

A number of options are available to achieve the scale break style your charts require. The style can be set with the ScaleBreakStyle enumeration at the axis level as shown below.

 

[C#]

Chart.YAxis.ScaleBreakStyle = ScaleBreakStyle.ZigZag;

[Visual Basic]

Chart.YAxis.ScaleBreakStyle = ScaleBreakStyle.ZigZag

Sample: AxisScaleBreakStyling.aspx


Scale Influentials
Objects that inherit from ScaleRange, such as AxisMarker and AxisTicks are able to influence the axis’ scale range. For instance, a chart showing bandwidth usage over a period of time with an axis marker representing the bandwidth limit may have elements that will never reach or even come close to the quota marker’s value. Because of this, the quota marker will not be visible on the chart; however, if AxisMarker.IncludeInAxisScale is true, the marker will tell the axis scale to encompass its value.

Objects that can influence axis scales are:

Sample: AxisAffectScale.aspx